﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Linq.Expressions;
using Newtonsoft.Json.Linq;

using CanDoo;
using CanDoo.Core;
using CanDoo.Data;
using CanDoo.Web;
using CanDoo.FineUI;
using CanDoo.Extensions;
using CanDoo.Oil.Core.Models;
using CanDoo.Oil.Core.Contracts;
using CanDoo.Admin.Core.Contracts;
using FineUIPro;

namespace CanDoo.Oil.WebApp.oilOilLevel
{
    public partial class Edit : EditPagebase<IOilLevelContract, OilLevel>
    {
        /// <summary>
        /// 本页面的浏览权限，空字符串表示本页面不受权限控制
        /// </summary>
        public override string PageCode
        {
            get
            {
                return "sysDictionary";
            }
        }

        /// <summary>
        /// 本页面的浏览权限，空字符串表示本页面不受权限控制
        /// </summary>
        public override string ViewPower
        {
            get
            {
                return "sysDictionaryview";
            }
        }
        protected void Page_Load(object sender, EventArgs e)
        {
            if (!IsPostBack)
            {
                if (PageMode != pagemode.Add)
                    LoadData();
            }
        }

        protected override void LoadData(OilLevel entity)
        {
            ed_Name.SetValue(entity.Name);
            ed_Code.SetValue(entity.Code);
            ed_Enable.SetValue(entity.Enable);
            ed_Remark.SetValue(entity.Remark);
            ed_SortIndex.SetValue(entity.SortIndex);
        }

        protected override OperationResult SaveData(OilLevel entity)
        {
            entity.Code = ed_Code.GetValue();
            entity.Name = ed_Name.GetValue();
            entity.Enable = ed_Enable.GetValue() ;
            entity.SortIndex = ed_SortIndex.GetValue().ToInt();
            entity.Remark = ed_Remark.GetValue();
            return base.SaveData(entity);
            
        }
    }
}
